import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/layout'
    },
    {
      path: '/userLogin',
      name: 'UserLogin',
      component: () => import('../views/login/UserLogin.vue')
    },
    {
      path: '/layout',
      name: 'Layout',
      redirect: 'layout/articleHome',
      component: () => import('../components/Layout.vue'),
      children: [{
        path: 'articleHome',
        name: 'articleHome',
        component: () => import('../components/ArtilceHome.vue')
      }, {
        path: 'articlePublish',
        name: 'ArticlePublish',
        component: () => import('@/views/artilce/ArticlePublish.vue')
      }, {
        path: '/article/:articleId',
        name: 'NavFooter',
        component: () => import('@/components/showArtilceDetail.vue')
      }, {
        path: '/user/userInfoDetaile',
        name: 'UserInfoDetaile',
        component: () => import('@/components/UserInfoDetaile.vue'),
        children: [{
          path: '/user/userIntroduce',
          name: 'UserIntroduce',
          component: () => import('@/views/user/UserIntroduce.vue')
        }]
      },
      {
        path: 'aiCommunication',
        name: 'AiCommunication',
        component: () => import('@/components/float/AiCommunicationView.vue')
      }
      ]
    },

    {
      path: '/userCenter',
      name: 'UserCenter',
      component: () => import('@/views/user/UserCenter.vue')
    }
  ]
})

export default router
